package org.sixtynine.stock.service.impl;

import java.util.Date;
import java.util.List;

import org.sixtynine.stock.dao.IpgReturnDao;
import org.sixtynine.stock.dto.GridPramDTO;
import org.sixtynine.stock.dto.Page;
import org.sixtynine.stock.entity.IpgReturn;
import org.sixtynine.stock.service.IpgReturnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Thilan
 * 
 */

@Service
public class IpgReturnServiceImpl implements IpgReturnService {

	@Autowired
	private IpgReturnDao ipgReturnDao;

	@Override
	public IpgReturn findById(int id) {
		return ipgReturnDao.findById(id);
	}

	@Override
	@Transactional(readOnly = false)
	public void saveIpgReturn(IpgReturn payment) {
		ipgReturnDao.saveIpgReturn(payment);
	}

	@Override
	@Transactional(readOnly = false)
	public void deleteIpgReturn(int id) {
		IpgReturn ipgReturn = ipgReturnDao.findById(id);
		if (ipgReturn != null) {
			ipgReturnDao.delete(ipgReturn);
		}
	}

	@Override
	public IpgReturn searchIpgReturn(String orderId) {
		return ipgReturnDao.searchIpgReturn(orderId);
	}

	@Override
	public List<IpgReturn> searchIpgReturn(Date fromDate, Date toDate,
			String orderBy) {
		return ipgReturnDao.searchIpgReturn(fromDate, toDate, orderBy);
	}

	@Override
	public Page<IpgReturn> searchIpgReturn(Date fromDate, Date toDate,
			String orderBy, GridPramDTO gridPramDTO) {
		return ipgReturnDao.searchIpgReturn(fromDate, toDate, orderBy,
				gridPramDTO);
	}

}
